package com.tian.view.touch.dispatch

import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
import android.widget.LinearLayout

/**
 * @author tiansongtao
 * @date 2023/1/10 15:57
 */
class CustomGrandparentLayout(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
        LinearLayout(context, attrs, defStyleAttr) {

    constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
    constructor(context: Context) : this(context, null)

    private val TAG = "tiansongtao"

    override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
        Log.i(TAG, "CustomGrandparentLayout dispatchTouchEvent: MotionEvent.action=${ev?.action}")
        return super.dispatchTouchEvent(ev)
    }

    override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
        Log.i(TAG, "CustomGrandparentLayout onInterceptTouchEvent: MotionEvent.action=${ev.action}")

        return super.onInterceptTouchEvent(ev)
    }

    override fun onTouchEvent(event: MotionEvent?): Boolean {
        Log.i(TAG, "CustomGrandparentLayout onTouchEvent: MotionEvent.action=${event?.action}")
        return super.onTouchEvent(event)
    }


}